#pragma once
#include "non_copy_able.h"
#define _WINSOCKAPI_
#include <Windows.h>
#include "functor.h"

namespace el
{
	class Thread :noncopyable
	{
	public:
		typedef unsigned long ThreadId;

		Thread();
		~Thread();

		HANDLE start(const Functor& process);
		void wait();
		HANDLE thread();
		ThreadId threadId();
		bool isRunning();

	protected:
		void run();
	private:
		static DWORD WINAPI threadProcess(LPVOID lpParam);
	
	private:
		HANDLE thread_;
		ThreadId thread_id_;
		Functor process_;
	};

}


